package cn.qyd.javamap;

import java.util.Map;
import java.util.TreeMap;

/**
 * @author 邱运铎
 * @date 2024-03-16 15:33
 */
public class TreeMapDemo {
    private final static int MOD = 1000000007;
    public static void main(String[] args) {
        System.out.println(10E8 + 7);
        System.out.println(1 / 2);
        System.out.println((-418310634 + MOD) % MOD);
        TreeMap<Integer,String> treeMap = new TreeMap();
        treeMap.put(1,"qiuyunduo");
        treeMap.put(2,"qyd");
        treeMap.put(3,"Java");
        treeMap.put(4,"C++");
        treeMap.put(8,"python");
        Map.Entry<Integer, String> entry = treeMap.firstEntry();
        Integer key = treeMap.firstKey();
        System.out.println(entry.getKey() + entry.getValue() + key);
        entry = treeMap.lastEntry();
        key = treeMap.lastKey();
        System.out.println(entry.getKey() + entry.getValue() + key);
        System.out.println(treeMap.headMap(3));
        System.out.println(treeMap.tailMap(3));
        System.out.println(treeMap.subMap(2,4));

        for (Map.Entry<Integer,String> entry1 : treeMap.entrySet()) {
            System.out.println(entry1.getKey());
            System.out.println(entry1.getValue());
        }
    }
}
